package oop.day03;

public class AnnoInnerClassDemo
{
    public static void main(String[] args)
    {
        test test = new test()
        {
            // 重写接口的方法必须为public
            @Override
            public void test1()
            {
                System.out.println("test1");
            }
            @Override
            public void test2()
            {
                System.out.println("test2");
            }
        };
        test.test1();
        test.test2();
        test test1 = test;
        System.out.println("test =  " +test);
        System.out.println("test1 = " +test1);
        test1.test1();
        test1.test2();

        test test2 = new test()
        {
            @Override
            public void test1()
            {
                System.out.println("test1 test1");
            }

            @Override
            public void test2()
            {
                System.out.println("test1 test2");
            }
        };
        System.out.println("test2 = " + test2);
        // 赋值出来也是相同的一个接口对象  地址相同
        test test3 = test2;
        System.out.println("test3 = " +test3);
        System.out.println(test2 == test3);
        System.out.println(test3.getClass());

    }
}


interface test
{
    void test1();
    void test2();
}